﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Text;

namespace Web_HengliSeed.en_us
{
    public partial class Article : PageBase
    {
        public string Title = string.Empty;
        public string Date = string.Empty;
        public string Content = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetNewsInfo();
            }
        }

        public string GetNewsClass()
        {
            using (OleDbDataReader read = BLL.NewsInfo.GetClassMesAll(language))
            {
                StringBuilder sbHtml = new StringBuilder();
                sbHtml.Append("<ul>");
                while (read.Read())
                {
                    sbHtml.Append(string.Format("<li><a href='Articles.aspx?c={0}'>{1}</a></li>", read["T_NewsClassID"], read["T_NewsClassName"]));
                }
                sbHtml.Append("</ul>");

                return sbHtml.ToString();
            }
        }

        private void GetNewsInfo()
        {
            using (OleDbDataReader red = BLL.NewsInfo.GetNewsInfo(Request["s"]))
            {
                while (red.Read())
                {
                    Title = red["T_NewsTitle"].ToString();
                    Content = Server.HtmlDecode(red["T_NewsNote"].ToString());
                    Date = String.IsNullOrEmpty(red["T_DateTime"].ToString()) ? DateTime.Now.ToShortDateString() : DateTime.Parse(red["T_DateTime"].ToString()).ToShortDateString();

                    //lContent.Text = Content;
                }
            }
        }
    }
}